import java.util.*;

public class Internationalization
{
	public String			sTitle;
	
	public String			sYes;
	public String			sNo;
	public String			sCancel;
	public String			sQuit;
	
	public String			sNew;
	public String			sOpen;
	public String			sLoadAnimation;
	
	public String			sSave;
	public String			sSaveAs;
	public String			sSaveAnimation;
	public String			sSaveAnimationAs;
	
	public String			sAdd;
	public String			sAddState;
	public String			sAddTransition;
	public String			sEdit;
	public String			sDelete;
	
	public String			sAbout;
	public String			sManual;
	
	public String			sMenuFile;
	public String			sMenuHelp;
	public String			sMenuOption;
	public String			sMenuAction;
	
	public String			sLabelStateName;
	public String			sLabelStateSet;
	public String			sLabelInitState;
	public String			sLabelFinalState;
	public String			sLabelLabel;
	
	public String			sSelectAlgo;
	public String			sPrepareAnimation;
	public String			sDisplayResult;
	public String			sStepByStep;
	public String			sTemporized;
	public String			sStepForward;
	public String			sStepBackWards;
	public String			sStopAnim;
	public String			sRefresh;
	
	
	private Locale			currentLocale;
	private ResourceBundle	names;
	
	
	/**
	 * ResourceBundle Initialize the attributes of the Internationalization
	 * class.
	 * 
	 * @param names
	 *            ResourceBundle corresponding to the chosen language.
	 */
	private void initName(ResourceBundle names)
	{
		sTitle = names.getString("title");
		
		sYes = names.getString("yes");
		sNo = names.getString("no");
		sCancel = names.getString("cancel");
		sQuit = names.getString("quit");
		
		sNew = names.getString("new");
		sOpen = names.getString("open");
		sLoadAnimation = names.getString("loadAnimation");
		
		sSave = names.getString("save");
		sSaveAs = names.getString("saveAs");
		sSaveAnimation = names.getString("saveAnimation");
		sSaveAnimationAs = names.getString("saveAnimationAs");
		
		sAdd = names.getString("add");
		sAddState = names.getString("addState");
		sAddTransition = names.getString("addTransition");
		sEdit = names.getString("edit");
		sDelete = names.getString("delete");
		
		sAbout = names.getString("about");
		sManual = names.getString("manual");
		
		sMenuFile = names.getString("menuFile");
		sMenuHelp = names.getString("menuHelp");
		sMenuOption = names.getString("menuOption");
		sMenuAction = names.getString("menuAction");
		
		sLabelStateName = names.getString("labelStateName");
		sLabelStateSet = names.getString("labelStateSet");
		sLabelInitState = names.getString("labelInitState");
		sLabelFinalState = names.getString("labelFinalState");
		sLabelLabel = names.getString("labelLabel");
		
		sSelectAlgo = names.getString("selectAlgo");
		sPrepareAnimation = names.getString("prepareAnimation");
		sDisplayResult = names.getString("displayResult");
		sStepByStep = names.getString("stepByStep");
		sTemporized = names.getString("temporized");
		sStepForward = names.getString("stepForward");
		sStepBackWards = names.getString("stepBackwards");
		sStopAnim = names.getString("stopAnimation");
		sRefresh = names.getString("refresh");
	}
	
	/**
	 * Default contructor with the english language.
	 */
	
	public Internationalization()
	{
		currentLocale = new Locale("en", "GB");
		names = ResourceBundle.getBundle("UserInterface", currentLocale);
		initName(names);
	}
	
	
	/**
	 * Contructor with the chosen language.
	 * 
	 * @param language
	 *            Chosen language.
	 * @param country
	 *            Chosen country.
	 */
	public Internationalization(String language, String country)
	{
		currentLocale = new Locale(language, country);
		names = ResourceBundle.getBundle("UserInterface", currentLocale);
		initName(names);
	}
	
	
	/**
	 * Modifies the chosen language.
	 * 
	 * @param language
	 *            New chosen language.
	 * @param country
	 *            New chosen country.
	 */
	public void setInternationalization(String language, String country)
	{
		currentLocale = new Locale(language, country);
		names = ResourceBundle.getBundle("UserInterface", currentLocale);
		initName(names);
	}
	
}
